package com.test.springboot_test.stringTest;

import java.util.Arrays;

public class StringTest11 {

    public static void main(String[] args) {
        /**
         * 1.字符串的基本操作
         * 截取、拼接、分割。索引
         */
        //截取
        String str = "1+1=@2";
        System.out.println(str.substring(0, str.lastIndexOf("@")));
        System.out.println(str.substring(str.lastIndexOf("@") + 1));

        //拼接
        String str2[]={"a","b","c"};
        StringBuilder builder = new StringBuilder();
        for(String a : str2){
            builder.append(a);
        }
        System.out.println(builder.toString());

        //分割
        String str3 ="1,2,3,4,5,6";
        String[] split = str3.split(",");
        Arrays.asList(split).stream().forEach(System.out::println);

    }

}
